package API.DAY5.io;

import java.io.FileInputStream;
import java.io.IOException;

public class Test1 {
    public static void main(String[] args) throws IOException {
        //写入文件
        /*
        //        FileOutputStream fos = new FileOutputStream("fos.txt");
        FileOutputStream fos = new FileOutputStream("fos.txt",true);
        for(char c ='a'; c<= 'z';c++){
            fos.write(c);
        }
        System.out.println("文件写入成功");
        fos.close();
         */
        //读取文件
        FileInputStream fis = new FileInputStream("fos.txt");
        int d;
        while ((d=fis.read())!=-1){
            System.out.print((char)d);
        }
        System.out.println("文件读取成功");
        fis.close();
    }
}
